<?php


/**
 * @author Admin
 *
 *
 */
class StringCollection extends Collection {
	
	public function __construct( $string=null ){
	if( !empty($string) ){
	    if( ! is_string($string) ){
	      throw new Exception( "This collection only holds strings ");
	    }
	}
	$this->collection = explode(",",$string);
	}
		
	//TODO - Insert your code here
	/**
	*Add element to collection
	*@param ViewHelper
	*@param int
	*/
	public function addElement( string $str ){
	    $this->doAddElement ( $str );
	}
	/***
	 * Get the contents from a string
	 */
	public function fromArray( Array $input ){
		$this->collection = $input;
	}
	/**
	 * 
	 * gets a sting of all the strings
	 */
	public function toString(){
		if( is_array( $this->collection ) ){
			return implode(",",$this->collection);
		}
		return "";
	}
}


?>